{include file="public/layout"/}
<body class="rolecss bodystyle" style=" overflow-y: scroll;min-width:auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
{include file="system/left" /}
<div class="page min-hg-c-10" style="min-width:auto;margin-left:100px;">
    <div class="flexigrid htitx">
        <div id="" class="explanation">
            <ul>
                <li>以下收款接口，本系统仅提供API接入服务，收款平台的可靠性请自行斟酌!</li>
                <li>收款接口选用，有相关执照的商家推荐使用官方接口。个人用户推荐使用虎皮椒</li>
            </ul>
        </div>
        <form id="postConfig" data-url="{:url('System/api_conf', ['_ajax' => 1])}">
            <div class="ncap-form-default" id="accordions">
                <div class="hDiv">
                    <div class="hDivBox">
                        <table cellspacing="0" cellpadding="0" style="width: 100%">
                            <thead><tr><th axis="col0"><div class="text-l10">接口设置</div></th></tr></thead>
                        </table>
                    </div>
                </div>

                <dl class="row">
                    <dt class="tit"><label>微信收款接口</label></dt>
                    <dd class="opt">
                        <label class="curpoin">
                            <input type="radio" name="pay[pay_wechat_open]" value="1" {if condition="!empty($pay_wechat_open) && 1 === intval($pay_wechat_open)"} checked="checked" {/if}>微信官方
                        </label>
                        &nbsp; &nbsp;
                        <label class="curpoin">
                            <input type="radio" name="pay[pay_wechat_open]" value="2" {if condition="!empty($pay_wechat_open) && 2 === intval($pay_wechat_open)"} checked="checked" {/if}>虎皮椒支付-微信
                        </label>
                        &nbsp; &nbsp;
                        <label class="curpoin">
                            <input type="radio" name="pay[pay_wechat_open]" value="0" {if condition="empty($pay_wechat_open)"} checked="checked" {/if}>关闭微信收款
                        </label>
                    </dd>
                </dl>

                <dl class="row">
                    <dt class="tit"><label>余额支付</label></dt>
                    <dd class="opt">
                        <label class="curpoin">
                            <input type="radio" name="pay[pay_balance_open]" value="1" {if condition="!empty($pay_balance_open)"} checked="checked" {/if}>开启
                        </label>
                        &nbsp;
                        <label class="curpoin">
                            <input type="radio" name="pay[pay_balance_open]" value="0" {if condition="empty($pay_balance_open)"} checked="checked" {/if}>关闭
                        </label>
                    </dd>
                </dl>

                <div class="mb15 some-parent-class">
                    <div class="hDiv api_poplistdiv">
                        <div class="hDivBox">
                            <table cellspacing="0" cellpadding="0" style="width: 100%">
                                <thead>
                                <tr>
                                    <th class="" axis="col0">
                                        <div class="curpoin"><a class="links" style="color: #555;margin-left: 10px;"><i class="fa fa-angle-right"></i>微信配置</a></div>
                                    </th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                    <div class="api_poplistdiv_down" style="display: none;">
                        <dl class="row">
                            <div id="" class="explanation">
                                <ul>
                                    <li><a href="JavaScript:void(0);" onclick="click_to_eyou_1575506523('https://www.eyoucms.com/plus/view.php?aid=8829&origin_eycms=1','微信支付配置教程')" >微信支付配置教程</a></li>
                                </ul>
                            </div>
                            <dt class="tit pt10">
                                <label for="">微信企业支付</label>
                            </dt>
                            <dd class="opt">
                                <dl class="row">
                                    <dt class="tit">
                                        <label for="username"><em class="em_empty {notempty name='$pay_info.is_open_wechat'} none {/notempty}">*</em>微信AppId</label>
                                    </dt>
                                    <dd class="opt">
                                        <input type="text" name="pay_info[appid]" id="appid" value="{$pay_info.appid|default=''}" class="input-txt" autocomplete="off">
                                        <p class="notic">请输入您的微信公众平台中的微信AppId，用于微信支付。</p>
                                    </dd>
                                </dl>
                                <dl class="row">
                                    <dt class="tit">
                                        <label for="username"><em class="em_empty {notempty name='$pay_info.is_open_wechat'} none {/notempty}">*</em>微信商户号</label>
                                    </dt>
                                    <dd class="opt">
                                        <input type="text" name="pay_info[mchid]" id="mchid" value="{$pay_info.mchid|default=''}" class="input-txt" autocomplete="off">
                                        <p class="notic">请输入您的微信公众平台中的微信商户号，用于微信支付。</p>
                                    </dd>
                                </dl>
                                <dl class="row">
                                    <dt class="tit">
                                        <label for="username"><em class="em_empty {notempty name='$pay_info.is_open_wechat'} none {/notempty}">*</em>微信KEY值</label>
                                    </dt>
                                    <dd class="opt">
                                        <input type="text" name="pay_info[key]" id="key" value="{$pay_info.key|default=''}" class="input-txt" autocomplete="off">
                                        <p class="notic">请输入您的微信公众平台中的微信KEY值，用于微信支付。</p>
                                    </dd>
                                </dl>
                            </dd>
                        </dl>
                    </div>
                </div>

                <div class="mb15 some-parent-class">
                    <div class="hDiv api_poplistdiv">
                        <div class="hDivBox">
                            <table cellspacing="0" cellpadding="0" style="width: 100%">
                                <thead>
                                <tr>
                                    <th class="" axis="col0">
                                        <div class="curpoin"><a class="links" style="color: #555;margin-left: 10px;"><i class="fa fa-angle-right"></i>虎皮椒配置</a></div>
                                    </th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                    <div class="api_poplistdiv_down" style="display: none;">
                        <dl class="row">
                            <div id="" class="explanation">
                                <ul>
                                    <li><a href="JavaScript:void(0);" onclick="click_to_eyou_1575506523('https://www.eyoucms.com/plus/view.php?aid=10167','虎皮椒支付配置')">虎皮椒支付配置</a></li>
                                </ul>
                            </div>
                            <dt class="tit pt10">
                                <label for="">虎皮椒支付</label>
                            </dt>
                            <dd class="opt">
                                
                                <dl class="row">
                                    <dt class="tit">
                                        <label for="alipay_appid">支付宝AppId</label>
                                    </dt>
                                    <dd class="opt">
                                        <input type="text" name="pay_info[alipay_appid]" id="alipay_appid" value="{$pay_info.alipay_appid}" class="input-txt">
                                        <p class="notic">请输入您的虎皮椒的支付宝AppId，用于支付。</p>
                                    </dd>
                                </dl>
                                <dl class="row">
                                    <dt class="tit">
                                        <label for="alipay_appsecret">支付宝AppSecret</label>
                                    </dt>
                                    <dd class="opt">
                                        <input type="text" name="pay_info[alipay_appsecret]" id="alipay_appsecret" value="{$pay_info.alipay_appsecret}" class="input-txt">
                                        <p class="notic">请输入您的虎皮椒的支付宝AppSecret，用于支付。</p>
                                    </dd>
                                </dl>
                                <dl class="row">
                                    <dt class="tit">
                                        <label for="wechat_appid">微信AppId</label>
                                    </dt>
                                    <dd class="opt">
                                        <input type="text" name="pay_info[wechat_appid]" id="wechat_appid" value="{$pay_info.wechat_appid}" class="input-txt">
                                        <p class="notic">请输入您的虎皮椒的微信AppId，用于支付。</p>
                                    </dd>
                                </dl>
                                <dl class="row">
                                    <dt class="tit">
                                        <label for="wechat_appsecret">微信AppSecret</label>
                                    </dt>
                                    <dd class="opt">
                                        <input type="text" name="pay_info[wechat_appsecret]" id="wechat_appsecret" value="{$pay_info.wechat_appsecret}" class="input-txt">
                                        <p class="notic">请输入您的虎皮椒的微信AppSecret，用于支付。</p>
                                    </dd>
                                </dl>
                                <dl class="row">
                                    <dt class="tit">
                                        <label for="gateway_domain">支付网关域名</label>
                                    </dt>
                                    <dd class="opt">
                                        <input type="text" name="pay_info[gateway_domain]" id="gateway_domain" value="{$pay_info.gateway_domain}" class="input-txt" placeholder="例如：https://api.xunhupay.com">
                                        <p class="notic">请填写你申请支付通道的平台的域名</p>
                                    </dd>
                                </dl>
                            </dd>
                        </dl>
                    </div>
                </div>

                <div class="bot"><a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" onclick="submitConfig();">确认提交</a></div>
            </div>
        </form>
    </div>
</div>

<script type="text/javascript">
    $(function() {  
        var Accordion = function(el, multiple) {  
            this.$el = el;  
            this.multiple = multiple || false;  
            this.$el.on('click', '.links', this.dropdown.bind(this));  
        };  
        Accordion.prototype.dropdown = function(event) {  
            event.preventDefault();  
            var $next = $(event.target).closest('.some-parent-class').find('.api_poplistdiv_down');  
            $next.slideToggle();  
            $next.closest('.some-parent-class').toggleClass('open');  
        };  
        var accordion = new Accordion($('#accordions'), false);

        var to = "{$Request.param.sys}";
        if (to) {
            var div_top = document.getElementById(to).offsetTop;
            window.scrollTo(0, div_top + 70);
        }
        //右侧浮动点击定位到相应模块
        var lis = document.getElementsByClassName("event");
        for(var i = 0; i < lis.length; i++) {
            lis[i].onclick = function() {
                //获取当前event的data-to属性值，用来匹配目标div
                var attr = this.getAttribute("data-to");
                //获取与当前event想匹配的div距离页面顶端的距离
                var div_top = document.getElementById(attr).offsetTop;
                window.scrollTo(0, div_top + 70);
            }
        }
    });

    // 表单提交
    function submitConfig() {
        layer_loading('正在处理');
        $.ajax({
            type: "POST",
            url : $('#postConfig').data('url'),
            data: $('#postConfig').serialize(),
            dataType: 'json',
            success: function (res) {
                layer.closeAll();
                if (1 === parseInt(res.code)) {
                    showSuccessMsg(res.msg, 1000, function() {
                        window.location.reload();
                    });
                } else {
                    showErrorAlert(res.msg);
                }
            },
            error: function(e) {
                layer.closeAll();
                showErrorAlert(e.responseText);
            }
        });
    }
</script>

{include file="public/footer" /}
